<?php if (!defined('THINK_PATH')) exit();?><html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> 
  <meta name="format-detection" content="telephone=no">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <link rel="stylesheet" type="text/css" href="/Public/css/index.css">
  <script type="text/javascript" src="/Public/js/jquery-1.11.3.min.js"></script>
</script> 
  <title>宠物防丢器--添加信息</title>
</head>
<body>
<div class="addinfo_all">
  <div class="addinfo_top">
    <img src="/Public/img/logo.png" width="40px" /><div class="fontinfo_add">信息添加</div>
  </div>
  <div class="info_gn_add">
    <div class="info_left">宠物名字:</div><div class="info_right"><input type="text" value="<?php echo ($info["petname"]); ?>" class="petname" placeholder="宠物の名字" /></div>
  </div>

  <div class="clear"></div>

  <div class="info_gn_add">
    <div class="info_left">宠物年龄:</div><div class="info_right">
    <select name="year" id="year" class="gn_add">
      <option value="0" <?php if($info["ye"] == 0): ?>selected="selected"<?php endif; ?> >年龄</option>
      <option value="0" <?php if($info["ye"] == 0): ?>selected="selected"<?php endif; ?>>0年</option>
      <option value="1" <?php if($info["ye"] == 1): ?>selected="selected"<?php endif; ?>>1年</option>
      <option value="2" <?php if($info["ye"] == 2): ?>selected="selected"<?php endif; ?>>2年</option>
      <option value="3" <?php if($info["ye"] == 3): ?>selected="selected"<?php endif; ?>>3年</option>
      <option value="4" <?php if($info["ye"] == 4): ?>selected="selected"<?php endif; ?>>4年</option>
      <option value="5" <?php if($info["ye"] == 5): ?>selected="selected"<?php endif; ?>>5年</option>
      <option value="6" <?php if($info["ye"] == 6): ?>selected="selected"<?php endif; ?>>6年</option>
      <option value="7" <?php if($info["ye"] == 7): ?>selected="selected"<?php endif; ?>>7年</option>
      <option value="8" <?php if($info["ye"] == 8): ?>selected="selected"<?php endif; ?>>8年</option>
      <option value="9" <?php if($info["ye"] == 9): ?>selected="selected"<?php endif; ?>>9年</option>
      <option value="10" <?php if($info["ye"] == 10): ?>selected="selected"<?php endif; ?>>10年</option>
      <option value="11" <?php if($info["ye"] == 11): ?>selected="selected"<?php endif; ?>>11年</option>
      <option value="12" <?php if($info["ye"] == 12): ?>selected="selected"<?php endif; ?>>12年</option>
      <option value="13" <?php if($info["ye"] == 13): ?>selected="selected"<?php endif; ?>>13年</option>
      <option value="14" <?php if($info["ye"] == 14): ?>selected="selected"<?php endif; ?>>14年</option>
      <option value="15" <?php if($info["ye"] == 15): ?>selected="selected"<?php endif; ?>>15年</option>
      <option value="16" <?php if($info["ye"] == 16): ?>selected="selected"<?php endif; ?>>16年</option>
      <option value="17" <?php if($info["ye"] == 17): ?>selected="selected"<?php endif; ?>>17年</option>
      <option value="18" <?php if($info["ye"] == 18): ?>selected="selected"<?php endif; ?>>18年</option>

    </select>
    零
    <select name="mous" id="mous" class="gn_add">
      <option value="0" <?php if($info["mo"] == 0): ?>selected="selected"<?php endif; ?>>月龄</option>
      <option value="0" <?php if($info["mo"] == 0): ?>selected="selected"<?php endif; ?>>0个月</option>
      <option value="1" <?php if($info["mo"] == 1): ?>selected="selected"<?php endif; ?>>1个月</option>
      <option value="2" <?php if($info["mo"] == 2): ?>selected="selected"<?php endif; ?>>2个月</option>
      <option value="3" <?php if($info["mo"] == 3): ?>selected="selected"<?php endif; ?>>3个月</option>
      <option value="4" <?php if($info["mo"] == 4): ?>selected="selected"<?php endif; ?>>4个月</option>
      <option value="5" <?php if($info["mo"] == 5): ?>selected="selected"<?php endif; ?>>5个月</option>
      <option value="6" <?php if($info["mo"] == 6): ?>selected="selected"<?php endif; ?>>6个月</option>
      <option value="7" <?php if($info["mo"] == 7): ?>selected="selected"<?php endif; ?>>7个月</option>
      <option value="8" <?php if($info["mo"] == 8): ?>selected="selected"<?php endif; ?>>8个月</option>
      <option value="9" <?php if($info["mo"] == 9): ?>selected="selected"<?php endif; ?>>9个月</option>
      <option value="10" <?php if($info["mo"] == 10): ?>selected="selected"<?php endif; ?>>10个月</option>
      <option value="11" <?php if($info["mo"] == 11): ?>selected="selected"<?php endif; ?>>11个月</option>
      <option value="12" <?php if($info["mo"] == 12): ?>selected="selected"<?php endif; ?>>12个月</option>
    </select>
    零
    <select name="day" id="day" class="gn_add">
      <option value="0" <?php if($info["da"] == 0): ?>selected="selected"<?php endif; ?>>日龄</option>
      <option value="1" <?php if($info["da"] == 1): ?>selected="selected"<?php endif; ?>>1天</option>
      <option value="2" <?php if($info["da"] == 2): ?>selected="selected"<?php endif; ?>>2天</option>
      <option value="3" <?php if($info["da"] == 3): ?>selected="selected"<?php endif; ?>>3天</option>
      <option value="4" <?php if($info["da"] == 4): ?>selected="selected"<?php endif; ?>>4天</option>
      <option value="5" <?php if($info["da"] == 5): ?>selected="selected"<?php endif; ?>>5天</option>
      <option value="6" <?php if($info["da"] == 6): ?>selected="selected"<?php endif; ?>>6天</option>
      <option value="7" <?php if($info["da"] == 7): ?>selected="selected"<?php endif; ?>>7天</option>
      <option value="8" <?php if($info["da"] == 8): ?>selected="selected"<?php endif; ?>>8天</option>
      <option value="9" <?php if($info["da"] == 9): ?>selected="selected"<?php endif; ?>>9天</option>
      <option value="10" <?php if($info["da"] == 10): ?>selected="selected"<?php endif; ?>>10天</option>
      <option value="11" <?php if($info["da"] == 11): ?>selected="selected"<?php endif; ?>>11天</option>
      <option value="12" <?php if($info["da"] == 12): ?>selected="selected"<?php endif; ?>>12天</option>
      <option value="13" <?php if($info["da"] == 13): ?>selected="selected"<?php endif; ?>>13天</option>
      <option value="14" <?php if($info["da"] == 14): ?>selected="selected"<?php endif; ?>>14天</option>
      <option value="15" <?php if($info["da"] == 15): ?>selected="selected"<?php endif; ?>>15天</option>
      <option value="16" <?php if($info["da"] == 16): ?>selected="selected"<?php endif; ?>>16天</option>
      <option value="17" <?php if($info["da"] == 17): ?>selected="selected"<?php endif; ?>>17天</option>
      <option value="18" <?php if($info["da"] == 18): ?>selected="selected"<?php endif; ?>>18天</option>
      <option value="19" <?php if($info["da"] == 19): ?>selected="selected"<?php endif; ?>>19天</option>
      <option value="20" <?php if($info["da"] == 20): ?>selected="selected"<?php endif; ?>>20天</option>
      <option value="21" <?php if($info["da"] == 21): ?>selected="selected"<?php endif; ?>>21天</option>
      <option value="22" <?php if($info["da"] == 22): ?>selected="selected"<?php endif; ?>>22天</option>
      <option value="23" <?php if($info["da"] == 23): ?>selected="selected"<?php endif; ?>>23天</option>
      <option value="24" <?php if($info["da"] == 24): ?>selected="selected"<?php endif; ?>>24天</option>
      <option value="25" <?php if($info["da"] == 25): ?>selected="selected"<?php endif; ?>>25天</option>
      <option value="26" <?php if($info["da"] == 26): ?>selected="selected"<?php endif; ?>>26天</option>
      <option value="27" <?php if($info["da"] == 27): ?>selected="selected"<?php endif; ?>>27天</option>
      <option value="28" <?php if($info["da"] == 28): ?>selected="selected"<?php endif; ?>>28天</option>
      <option value="29" <?php if($info["da"] == 29): ?>selected="selected"<?php endif; ?>>29天</option>
      <option value="30" <?php if($info["da"] == 30): ?>selected="selected"<?php endif; ?>>30天</option>
      <option value="31" <?php if($info["da"] == 31): ?>selected="selected"<?php endif; ?>>31天</option>
    </select></div>
  </div>
<div class="clear"></div>
<div class="info_gn_add">
    <div class="info_left">宠物类型:</div>
    <div class="info_right">
      <select class="petclass">
        <option value="0" <?php if($info["pettype"] == 0): ?>selected="selected"<?php endif; ?>>选择宠物种类</option>
        <option value="1" <?php if($info["pettype"] == 1): ?>selected="selected"<?php endif; ?>>狗狗</option>
        <option value="2" <?php if($info["pettype"] == 2): ?>selected="selected"<?php endif; ?>>猫咪</option>
        <option value="3" <?php if($info["pettype"] == 3): ?>selected="selected"<?php endif; ?>>兔子</option>
        <option value="4" <?php if($info["pettype"] == 4): ?>selected="selected"<?php endif; ?>>老鼠</option>
        <option value="5" <?php if($info["pettype"] == 5): ?>selected="selected"<?php endif; ?>>其他</option>
      </select>
    </div>
  </div>
<select class="month type-link value_info  anmimo-type2" >
<option value="0">选择宠物类型</option>
<?php if(is_array($petclassinfo)): $i = 0; $__LIST__ = $petclassinfo;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>11
<option value="<?php echo ($vo["p_t_id"]); ?>" <?php if($info["petclass"] == $vo['p_t_id']): ?>selected="selected"<?php endif; ?>><?php echo ($vo["p_t_name"]); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
</select>
  <div class="clear"></div>

<div class=" info_left_new">
    <div class="info_left ">主人电话:</div><div class="info_right"><input value="<?php echo ($info["tel"]); ?>" type="text" placeholder="主人の电话" class="tel"/></div>
  </div>
  <br/><br/>
  <div class=" info_left_new">
    <div class="info_left">主人QQ:</div><div class="info_right"><input type="text" value="<?php echo ($info["qq"]); ?>" placeholder="主人のQQ" class="qq"/></div>
  </div>
  <br/><br/>
 <div class=" info_left_new">
    <div class="info_left">主人微信:</div><div class="info_right"><input type="text" value="<?php echo ($info["wx"]); ?>" placeholder="主人の微信" class="wx"/></div>
  </div>
  <br/><br/>
  <div class="clear"></div>
 <!--  <div class="info_left_new">
    <div class="info_left">宠物店名:</div><div class="info_right"><input type="text" value="<?php echo ($info["shopname"]); ?>" placeholder="哪个宠物店购买" class="shop_name"/></div>
  </div> -->
  
    <div class="clear"></div>
  <div class="submit">提交修改</div>

</div>

<script type="text/javascript">
  //选择宠物的种类之后
            $('.anmimo-type2').show();
            $('.petclass').change(function(){
            $('.anmimo-type2').show();
            var val=$(this).find('option:selected').val();
            $.getJSON("/Public/json/petclass.json",function(data){  
            var strHtmlC = "";//存储数据的变量   
            strHtmlC+='<option value="">'+'选择宠物类型'+'</option>';
            $.each(data,function(infoIndex,info){
              if(info['p_t_status']==val){
                strHtmlC+='<option value="'+info['p_t_id']+'">'+info['p_t_name']+'</option>';
              }
            }) 
            $('.anmimo-type2').empty();
            $('.anmimo-type2').append(strHtmlC);
            $('.anmimo-type2').attr('disabled',false);
            $('.anmimo-type2').css('background-color','#FFFFFF');
            })
          })
</script>

<script>
  $('.submit').one('click',function(){
  var petname=$('.info_right input').val();
  var ye=$('#year').val();
  var mo=$('#mous').val();
  var da=$('#day').val();
  var pettype=$('.petclass').val();
  var petclass=$('.value_info').val();
  var tel=$('.tel').val();
  var qq=$('.qq').val();
  var wx=$('.wx').val();
  var shopname=$('.shop_name').val();
  var key=$('.key').val();
  var password=$('.password').val();
   

var myreg = /^(((13[0-9]{1})|(17[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/; 
if(!myreg.test($(".tel").val())) 
{ 
    alert('请输入有效的手机号码！'); 
    return false; 
}
  $.post("<?php echo U('Index/in_gongnengadd');?>",{save:1,petname:petname,ye:ye,mo:mo,da:da,pettype:pettype,petclass:petclass,tel:tel,qq:qq,wx:wx,shopname:shopname,key:key,password:password},function(data){
    if(data.status==100){
      var val=data.info;
      alert('修改成功,将要跳转到首页');
      location.href="<?php echo U('Index/index');?>";
    }else{
      alert('修改失败');
    }
  })
  })

</script>
</body>
</html>